package pkg

import (
	"encoding/json"
	"github.com/Baidu-AIP/golang-sdk/aip/censor"
)

type Review struct {
	ConclusionType uint `json:"conclusionType"`
}

func Video(url string) bool {
	client := censor.NewClient("TAXUcEDtneOeQgN2RsSRt9lM", "uLyyT9n1ZtOg76mE61vbhI4uWK5ueizF")

	res := client.VideoCensor("音频文件url", url, "", nil)
	var ress Review
	if err := json.Unmarshal([]byte(res), &ress); err != nil {
		return false
	}
	return true
}
func Content(text string) bool {
	client := censor.NewClient("TAXUcEDtneOeQgN2RsSRt9lM", "uLyyT9n1ZtOg76mE61vbhI4uWK5ueizF")

	res := client.TextCensor(text)
	var ress Review
	if err := json.Unmarshal([]byte(res), &ress); err != nil {
		return false
	}
	return ress.ConclusionType == 1
}
